package main

import (
	"go-rpc/service"
	"log"
	"net"
	"net/rpc"
	"net/rpc/jsonrpc"
)

func main() {

	service := new(service.ServiceA)

	rpc.Register(service)
	l, e := net.Listen("tcp", "localhost:9091")

	if e != nil {
		log.Fatal("listen error:", e)

	}

	for {
		conn, _ := l.Accept()

		rpc.ServeCodec(jsonrpc.NewServerCodec(conn))
	}

}
